<!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 14:05:02
 * @LastEditors: [wangll]
 * @LastEditTime: 2021-09-23 18:21:54
-->
<template>
  <div>
    <!-- 头部开始 -->
    <Header/>
    <!-- 头部结束 -->
    
    <!-- 体部开始 -->
    <div class="body_content">
      <div class="wrapper">
        <div class="left">
          <div class="article" >
              <div class="title">{{concentrate.title}}</div>
              <div class="time">
                <span>发表时间:{{concentrate.publishTime | fmtDate}}</span>
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <span>阅读次数:{{concentrate.readTimes}}</span>
              </div>
              <div class="inner_content" v-html="concentrate.content"></div>
          </div>
        </div>
        <div class="right">
          <Table></Table>
        </div>
      </div>
    </div>
    <!-- 体部结束 -->
    
    <!-- 底部开始 -->
    <Footer/>
    <!-- 底部结束 -->
  </div>
</template>
<script>
import {get} from '../utils/request'
import Header from '../components/Header.vue'
import Footer from '../components/Footer.vue'
import Table from '../components/Table.vue'
export default {
  // 注册组件
  components:{
    Header,
    Footer,
    Table,
  },
  data(){
    return{
      concentrate:{},
      id:0
    }
  },
  created(){
    // 获取list传过来的id
    this.id=this.$route.query.id;
    this.loadConcentrate();

  },
  methods:{
    loadConcentrate(){
      let url='/index/article/findById';
      get(url,{id:this.id}).then(res=>{
        // console.log(res);
        this.concentrate=res.data;
      })
    }
  }
}
</script>
<style lang="scss">
  .body_content{
    background-color: #cbe3e5;
    & >.wrapper{
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
      .left{
        margin-top: 2em;
        // flex:1;
        width: 800px;
        margin-right: 2em;
        .article{
          background-color: #fff;
          min-height: 400px;
          margin: 2em;
          overflow: hidden;
          .title{
            font-size: 18px;
            text-align: center;
            margin: .5em;
          }
          .time{
            text-align: center;
          }
          .inner_content{
            padding: .5em;
            display: flex;
            flex-wrap: wrap;
          }
        }
      };
      .right{
        width: 400px;
        margin: 5em 2em;
      }
    }

  }
</style>